<?php
/**
 * UrlPostFeed.php
 *
 * @category    Madoqua
 * @package     View
 * @subpackage  Helper
 */

/** base class */
require_once 'Madoqua/View/Helper/Abstract.php';

/**
 * Madoqua_View_Helper_UrlPostFeed
 *
 * @category    Madoqua
 * @package     View
 * @subpackage  Helper
 */
class Madoqua_View_Helper_UrlPostFeed extends Madoqua_View_Helper_Abstract
{
    /**
     * generate a link to the post overview feed
     *
     * @return string
     */
    public function urlPostFeed($post, $type = 'rss')
    {

        if (is_object($post)) {
            $id = $post->id;
        } elseif (is_array($post)) {
            $id = $post['id'];
        } else {
            $id = $post;
        }
        //find slug

        return $this->url(array(
            'module' => 'feed',
            'controller' => 'post',
            'action' => 'single',
            'id' => $id,
            'type' => $type
        ), 'default', true);
        //url to feed/post/index/slug/$slug
    }
}